﻿@using KRM.Core
@{
    IEnumerable<tblPromotionSite> promotionSites = ViewBag.PromotionSites;
    IEnumerable<vPromotionOptionDetail> optionDetails = ViewBag.OptionDetail;
    IEnumerable<tblPromotionWidgetLink> promotionWidgets = ViewBag.PromotionWidgets;
}
<div class="row-fluid">
    <div class="span5">
        <div class="border-padding10">
            <div class="fieldset margin0">
                <div class="legend"><span>Websites</span></div>
                <table class="table table-bordered table-fix websitetable tbl-selected" data-height="100">
                    <thead>
                        <tr>
                            <th>Website</th>
                            <th>Pos</th>
                            <th>Category</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in promotionSites)
                        {
                            <tr onclick="updatePromWebsite(@item.ID);">
                                <td>@item.tblStore.StoreName</td>
                                <td>@item.Position</td>
                                <td>@item.RelatedCategory</td>
                            </tr>
                        }  
                    </tbody>
                </table>

                <a href="javascript:;" class="btn" onclick="deletePromoSite();">
                    <img src="~/img/Gnome-Edit-Delete-32.png" alt="" style="width: 20px" />
                </a>
                <a class="btn"  data-toggle="modal" href="#promotionWebsite">
                    <img src="~/img/Edit-32.png" alt="" style="width: 20px" />
                </a>
                <a class="btn" data-toggle="modal" href="#promotionWebsite" onclick="$('#positionPromo').val('0');$('#promositeid').val('');$('#lblRelatedCat').html('');$('#hdRelCat').val('');">
                    <img src="~/img/Gnome-Folder-New-32.png" alt="" style="width: 20px" />
                </a>
            </div>
        </div>
        <div class="border-padding10">
            <fieldset class="margin0">
                <legend>Promotion Widgets</legend>
                <div class="border-padding10 overflow-auto" style="height: 150px">
                    <label><input type="checkbox" id="1" onchange="promWidget(this)" class="cbcheck" @((promotionWidgets.FirstOrDefault(c => c.tblPromotionWidget.Name == "FrontPageBanner") != null)?"checked = 'checked'":"")/> FrontPageBanner</label>
                    <label><input type="checkbox" id="2" onchange="promWidget(this)" class="cbcheck" @((promotionWidgets.FirstOrDefault(c => c.tblPromotionWidget.Name == "CountDown") != null)?"checked = 'checked'":"")/> CountDown</label>
                    <label><input type="checkbox" id="3" onchange="promWidget(this)" class="cbcheck" @((promotionWidgets.FirstOrDefault(c => c.tblPromotionWidget.Name == "ProductPageBanner") != null)?"checked = 'checked'":"")/> ProductPageBanner</label>
                    <label><input type="checkbox" id="4" onchange="promWidget(this)" class="cbcheck" @((promotionWidgets.FirstOrDefault(c => c.tblPromotionWidget.Name == "ImageRibbons") != null)?"checked = 'checked'":"")/> ImageRibbons</label>
                    <label><input type="checkbox" id="5" onchange="promWidget(this)" class="cbcheck" @((promotionWidgets.FirstOrDefault(c => c.tblPromotionWidget.Name == "WasPrices") != null)?"checked = 'checked'":"")/> WasPrices</label>
                    <label><input type="checkbox" id="6" onchange="promWidget(this)" class="cbcheck" @((promotionWidgets.FirstOrDefault(c => c.tblPromotionWidget.Name == "CategoryPageBanner") != null)?"checked = 'checked'":"")/> CategoryPageBanner</label>
                    <label><input type="checkbox" id="7" onchange="promWidget(this)" class="cbcheck" @((promotionWidgets.FirstOrDefault(c => c.tblPromotionWidget.Name == "ProductPageBannerStatic") != null)?"checked = 'checked'":"")/> ProductPageBannerStatic</label>
                    <label><input type="checkbox" id="8" onchange="promWidget(this)" class="cbcheck" @((promotionWidgets.FirstOrDefault(c => c.tblPromotionWidget.Name == "CategoryPageBannerStatic") != null)?"checked = 'checked'":"")/> CategoryPageBannerStatic</label>
                </div>
            </fieldset>
        </div>
    </div>
    <div class="span7">
        <div class="border-padding10">
            <div class="fieldset margin0">
                <div class="legend"><span>Promotion Products</span></div>
                <a href="javascript:;" class="btn" onclick="deletePromoOption()">
                    <img src="~/img/Gnome-Edit-Delete-32.png" alt="" style="width: 20px" />
                </a>
                <a   data-toggle="modal" href="#promotionOption" class="btn">
                    <img src="~/img/Gnome-Folder-New-32.png" alt="" style="width: 20px" />
                </a>
                <input type="hidden" value="" id="promooptionid"/>
                <table class="table table-bordered table-fix productstable tbl-selected" data-height="350">
                    <thead>
                        <tr>
                            <th>Prod ID</th>
                            <th>OptionID</th>
                            <th>ProductName</th>
                            <th>ProductOptionBase</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach (var item in optionDetails)
                        {
                            <tr onclick="$('#promooptionid').val(@item.ID);">
                                <td>@item.ProductID</td>
                                <td>@item.ProductOptionID</td>
                                <td>@item.ProductOptionName</td>
                                <td>@item.ProductOptionBasePrice</td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>